function [meanQ,varQ] = computeQ(p,gp,x,u,f)
%
% [meanQ,varQ] = computeQ(p,gp,x,u,f)
%
% x: current state
% u: action for which current 
% computes Q(s,a) from a parameteric weight vector given the current state
% and an arbitrary action.
%
% tobias siegfried, 10/08/2008

% mean
xdVec = gp.dict(1:p.stateVDim,:);
adVec = gp.dict(p.stateVDim+1:end,:);
kt = kernel(p,xdVec,x,adVec,u);
meanQ = gp.alpha' * kt;

% test
% Q1 = 0;
% for i = 1 : length(gp.dict(1:p.stateVDim,:))
%     kt(i) = kernel(p,xdVec(i),x,adVec(i),u);
%     Q1 = Q1 + gp.alpha(i) * kt(i);
% end
% Q1'
% keyboard
    
% var

varQ = kernel(p,x,x,u,u) - kt' * gp.C * kt;

%keyboard
